#ifndef UNIVERSEMODEL_H_
#define UNIVERSEMODEL_H_

#include "common.h"

#include "../include/Universe.h"
#include "../include/instantiate.h"
#include "WorldFactory.h"
#include "hset.h"

namespace physicsworks {

class UniverseModel : public Universe {
	friend Universe* instanceUniverse();
	friend void destroyUniverse();

public:
	typedef HSet<WorldModel*>::Type WorldModelHSet;

private:
	WorldModelHSet worldModels;

public:
	void add(World* w);
	void remove(World* w);
	void removeAll() { worldModels.clear(); }
	World** getWorldsList(int* size);
	const WorldModelHSet& getWorldsListHSet() const { return worldModels; }
	World* instanceWorld(real aX, real aY, real aZ, real bX, real bY, real bZ,
	                     SpatialPartitioningType s, const SpatialPartitioningConfig& sc) const;
	Body* instanceBody(const real* vertX, const real* vertY, const real* vertZ, int numVertices,
	                   const int* verticesIndices, int numFaces) const;
	Body* instanceSphereBody(real radius) const;
	Body* instanceCubeBody(real radius) const;
	Body* instanceBoxBody(real radiusX, real radiusY, real radiusZ) const;

private:
	UniverseModel() {}
	~UniverseModel() {}
	UniverseModel(const UniverseModel&);
	UniverseModel& operator = (const UniverseModel&);
};

/**
 * Is the universe alive?
 */
bool universeAlive();

}

#endif /*UNIVERSEMODEL_H_*/
